package com.ld.security.server.admin.modules.ge.service.impl;


import com.ld.security.common.core.util.ReflectionUtil;
import com.ld.security.common.mybatis.base.service.*;
import com.ld.security.server.admin.modules.ge.entity.GeChartTelEntity;
import com.ld.security.server.admin.modules.ge.service.IGeChartService;

import com.ld.security.server.admin.modules.ge.entity.GeChartEntity;

import com.ld.security.server.admin.modules.ge.service.IGeChartService;

import com.ld.security.server.admin.modules.ge.service.IGeChartTelService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class GeChartServiceImpl  extends ISuperServiceImpl<GeChartEntity>
implements
        IGeChartService {

        IGeChartTelService iGeChartTelService;

        @Override
        public int save(GeChartEntity entity) {
                if(ReflectionUtil.isNull(entity.getConfig())){
                        GeChartTelEntity telEntity =  iGeChartTelService.getById(entity.getChartTelId());
                        entity.setConfig(telEntity.getConfig());
                        entity.setCode(telEntity.getCode());
                }
                return super.save(entity);
        }
}
